package com.widget;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import android.os.Handler;
import android.util.Log;

public class ChmodParser implements ParseStreaming {
	private int count;
	private int track = 0;
	private Handler mContext;
	@Override
	public int parseString(String content) {
		Pattern chown = Pattern.compile("chown");
		Matcher chownP = chown.matcher(content);
		while(chownP.find()){
			
			track++;
		}
		Log.d("CHOWN",count+"=="+track);
		if(track == count){
			Log.d("CHOWN", "Changed Mod :)))");
			mContext.sendEmptyMessage(QUIT);
			track =0;
			return 0;
		}
		return 1;
	}

	@Override
	public void endMatcher(int n, Handler c) {
		count=n;
		mContext =  c;

	}

}
